# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=gadget-tool
pkgver=0_git20220508
pkgrel=0
_commit="7f9c45d98425a27444e49606ce3cf375e6164e8e"
pkgdesc="Linux command line tool for setting USB gadget using configFS"
url="https://github.com/linux-usb-gadgets/gt"
arch="all"
license="Apache-2.0"
makedepends="
	asciidoc
	cmake
	libusbgx-dev
	samurai
	"
subpackages="$pkgname-doc $pkgname-bash-completion"
source="https://github.com/linux-usb-gadgets/gt/archive/$_commit/gt-$_commit.tar.gz"
builddir="$srcdir/gt-$_commit"
options="!check" # no test suite

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja -S source \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
1581996da5f96a07f7aedfb17c826bdb69aaf30bf39f17df60ab914178dbbd8f475e614899a884b80f961ede513eaaac6d8fd8138f723a4644afabb63fabc6dd  gt-7f9c45d98425a27444e49606ce3cf375e6164e8e.tar.gz
"
